let Stu1 = {
	name: "zs",
	age: 18,
	sex: "man",
};

let Stu2 = {
	name: "mm",
	age: 18,
	sex: "women",
};

/* 
Stu ，就是一个构造器。此处我们采用了 ES5 构造函数的写法，
因为 ES6 中的 class 其实本质上还是函数，class 语法只是语法糖，构造函数，才是它的真面目。
*/

function Stu(name, age, sex) {
	this.name = name;
	this.age = age;
	this.sex = sex;
}

const s1 = new Stu("a", 18, "man");
// console.log(s1);
/* 
接下来要做的事情，就是让程序自动地去读取数据库里面一行行的员工信息，
然后把拿到的姓名、年龄等字段塞进Stu函数里，进行一个简单的调用
*/

function User(name, age, career, work) {
	this.name = name;
	this.age = age;
	this.career = career;
	this.work = work;
}
// 简单的工厂模式
function Factory(name, age, career) {
	let work;
	switch (career) {
		case "coder":
			work = ["写代码", "写系分", "修Bug"];
			break;
		case "product manager":
			work = ["订会议室", "写PRD", "催更"];
			break;
		case "boss":
			work = ["喝茶", "看报", "见客户"];
        // 其它工种的职责分配
	}
    return new User(name, age, career, work);
}

// console.log(Factory('ts', 18 ,'coder'));

